import request from '@/utils/request'

// 获取频道 @returns Promise

export const getChannelApi = () => {
  return request({
    url: '/v1_0/user/channels'
  })
}


export const getAllChannelsAPI = () => {
  return request({
    url: '/v1_0/channels'
  })
}

/**
 * 删除我的频道
 */

export const delMyChannelAPI = (target) => {
  return request({
    url: `/v1_0/user/channels/${target}`,
    method: 'DELETE'
  })
}


/**
 * 添加我的频道
 * @param {number} id 频道的id
 * @param {number} seq 添加的索引
 * @returns Promise
 */

export const addMyChannel = (id, seq) => {
  return request({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels: [
        {
          id,
          seq
         }
       ]
    }
   })
}